package com.shansun.enums
{
	public class FormItemStyle
	{
		public static const INPUT:FormItemStyle = new FormItemStyle(0);
		public static const RADIO:FormItemStyle = new FormItemStyle(1);
		public static const AREA:FormItemStyle = new FormItemStyle(2);
		public static const SELECT:FormItemStyle = new FormItemStyle(3);
		private static var _limit:Boolean = false;
		
		private var _value:Object;
		
		public function get value():int {
			return _value as int;
		}
		
		public function FormItemStyle(value:Object)
		{
			if(_limit) {
				throw new Error("Cannot initialize Enum outside!");
			} 
			this._value = value;
			
			if(INPUT != null && RADIO != null && AREA != null && SELECT != null) {
				_limit = true;
			}
		}
		
		public function toString():String {
			switch(this._value as int) {
				case 0: return "INPUT";
				case 1: return "RADIO";
				case 2: return "AREA";
				case 3: return "SELECT";
			}
			return "UNKNOWN";
		}
	}
}